package com.zretc.emptraining.serviceimpl;

import java.util.List;

import com.zretc.emptraining.dao.TeachDao;
import com.zretc.emptraining.daoimpl.TeachDaoImpl;
import com.zretc.emptraining.dbtools.PageData;
import com.zretc.emptraining.entity.Teach;
import com.zretc.emptraining.service.TeachService;

public class TeachServiceImpl implements TeachService {
	TeachDao teachimpl = new TeachDaoImpl();
	@Override
	public boolean addTeach(Teach teach) {
		Teach t = teachimpl.getTeachByTeacheName(teach.getTeacherName());
		if(t != null) {
			return false;
		}
		return teachimpl.addTeach(teach);
	}
	
	@Override
	public boolean delTeach(int teachno) {
		if(teachno > 0) {
			return teachimpl.delTeachByTeachNo(teachno);
		}
		return false;
	}
	
	@Override
	public boolean updPic(Teach teach) {
		if(teach != null) {
			return teachimpl.updTeach(teach);
		}
		return false;
	}
	
	@Override
	public boolean updInfo(Teach teach) {
		if(teach != null) {
			return teachimpl.updInfo(teach);
		}
		return false;
	}
	
	@Override
	public PageData<Teach> getPageByTeachName(int page, int pageSize, String keyword) {
		if(page < 0) {
			page = 1;
		}
		return teachimpl.getPageByteachName(page, pageSize, keyword);
	}
	
	@Override
	public PageData<Teach> getPageByteachNo(int page, int pageSize, String keyword) {
		if(page < 0) {
			page = 1;
		}
		return teachimpl.getPageByteachNo(page, pageSize, keyword);
	}
	
	@Override
	public PageData<Teach> getPageByteachSex(int page, int pageSize, String keyword) {
		if(page < 0) {
			page = 1;
		}
		return teachimpl.getPageByteachSex(page, pageSize, keyword);
	}
	
	@Override
	public PageData<Teach> getPageByteachXl(int page, int pageSize, String keyword) {
		if(page < 0) {
			page = 1;
		}
		return teachimpl.getPageByteachXl(page, pageSize, keyword);
	}
	
	/**
	 * 获取所有的教员信息
	 */
	@Override
	public List<Teach> getAllTeachers() {
		// TODO Auto-generated method stub
		return teachimpl.getAllTeachers();
	}
	
	@Override
	public List<Teach> getTeachByTel(String teachtel) {
		// TODO Auto-generated method stub
		return teachimpl.getTeachByTel(teachtel);
	}
	
	@Override
	public boolean updInfoByDesc(String Tel, String desc, String teacherPic) {
		// TODO Auto-generated method stub
		return teachimpl.updInfoByDesc(Tel, desc, teacherPic);
	}

}
